package com.campus.controller;

import com.campus.entity.Student;
import com.campus.service.StudentService;
import com.campus.web.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/student")
public class StudentController {
@Autowired
    private StudentService studentService;
@PostMapping("/insert")
    public ResponseResult insert(@RequestBody Student student) {
    studentService.insertStudent(student);
    return ResponseResult.ok("添加成功");
}
@PostMapping("/inserts")
    public ResponseResult inserts(@RequestBody  List<Student> students) {
    studentService.insertStudents(students);
    return ResponseResult.ok("批量添加成功");
}
@PostMapping("/approve")
    public ResponseResult approve(@RequestBody Student student) {
    studentService.approveStudent(student);
    return ResponseResult.ok("审核成功");
}
@PutMapping("/approves")
    public ResponseResult approves(@RequestBody List<Integer> ids) {
    studentService.approveStudents(ids);
    return ResponseResult.ok("批量审核成功");
}
}
